<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 00:33:05
 * @LastEditTime: 2023-10-16 13:00:24
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: BOM成品工艺
 */

namespace App\Models;

use App\Traits\AutoCodeTrait;
use App\Traits\MaterialTrait;

class ProOutsourcingPlan extends BaseModel
{
    use MaterialTrait;
    use AutoCodeTrait;

    public $_auto_resetlot_name = false;
    public $ACSign = "PRO_OUT_PLAN";
    public $timestamps = true;
    public $table = "sys_pro_outsourcing_plan";
    protected $guarded = [];


    public function details()
    {
        return $this->hasMany(ProOutsourcingPlanDetail::class, "main_id");
    }

    public function outfactory()
    {
        return $this->belongsTo(Company::class);
    }
  
    public function product()
    {
        return $this->hasMany(ProOutsourcingProduct::class, "code", "code");
    }
}
